define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'business/record/index',
                    table: 'business_record',
                }
            });

            var RecordTable = $("#RecordTable");

            // 初始化表格
            RecordTable.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                toolbar: '#RecordToolbar',
                columns: [
                    [
                        { checkbox: true },
                        { field: 'id', title: __('Id'), sortable: true },
                        { field: 'business.nickname_text', title: __('Nickname'), operate: 'LIKE' },
                        { field: 'total', title: __('RTotal'), operate: 'LIKE' },
                        { field: 'content', title: __('RContent'), operate: 'LIKE' },
                        { field: 'createtime', title: __('RCreatetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange',  },
                        // { field: 'operate', title: __('Operate'), table: RecordTable, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
                    ]
                ]
            });
            // 为表格绑定事件
            Table.api.bindevent(RecordTable);
        },
        // add: function () {
        //     Controller.api.bindevent();
        // },
        // edit: function () {
        //     Controller.api.bindevent();
        // },
        // del: function () {
        //     Controller.api.bindevent();
        // },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});